<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">

		<title></title>
		<link rel="stylesheet" type="text/css" href="../css/common.css?01_34" />
		<link rel="stylesheet" type="text/css" href="../css/templet.css?01_34" />
		<link rel="stylesheet" type="text/css" href="../fonts/font-awesome.min.css?01_34" />
		<link rel="stylesheet" type="text/css" href="../mui/css/mui.css?01_34" />
		<link rel="stylesheet" type="text/css" href="../ali/iconfont.css?01_34" />
		<link rel="stylesheet" type="text/css" href="../css/queue.css"/>
		<script type="text/javascript" src="../common/js/jquery.js?01_34"></script>
		
		<!--插件-->
		<script type="text/javascript" src="../common/js/vue.min.js?01_34"></script>
		<script type="text/javascript" src="../common/js/mui.min.js?01_34"></script>
		<script type="text/javascript" src="../common/js/update.js?01_34"></script>
		
		<script type="text/javascript" src="../common/js/common.js?01_34"></script>
		<script type="text/javascript" src="../common/js/fastclick.js?01_34"></script>
		<script type="text/javascript" src="../common/js/main.js?01_34"></script>
		<script type="text/javascript" src="../common/js/app.js?01_34"></script>
		<style type="text/css">
			.childFooter .footerList .bg.bg_01 { background-image: url(../images/queue/fb_01.png);} 
		</style>
	</head>
	<body>
		<!--头部-->
		<header class="bg-red9 fff f-20 pad-t-10 pad-b-10 pad-r-10">
			<div class="pa back pad-l-10 back re" onclick="backpre()">
				<div class="order_back"></div>
				<a></a>
			</div>
			<div @click="test()" class="center header_title"></div>
			<!--<div class="pa set">
				<a href="queue_set.html" class="fff f-15 pad-r-10"><i></i></a>
			</div>-->
		</header>
		<div id="app" v-cloak="">
			<div class="wrap_body queue_printSetup bg-e4">
				
				<!--内容部分-->
				<div class="pad-t-45 pad-b-80">
					<p class="pad-12 pad-t-10 pad-b-10 fiex blue"><i class="i mag-r-7"></i>{{b_lg['1473']}}</p>
					<div class="list" @click="choose(item.id,item)" v-for="(item,index) in print_list">
						<div class="fiex bg-fff pad-t-20 pad-b-20 pad-l-12 pad-r-12">
							<div class="fiex1">{{item.printer_name}}</div>
							<div class="bg" v-bind:class="{ checked:item.checked == 1}"></div>
						</div>
						<div class="bank5"></div>
					</div>
					<div class="center pad-t-50 pad-b-20">
						<a class="btn bg-red9 fff pad-t-10 pad-b-10 pad-l-80 pad-r-80" @click="printSet()">{{b_lg['1008']}}</a>
					</div>
						
				</div> 
			</div>
		</div>
	</body>
	<script type="text/javascript">
		//头部返回键
		function backpre () {
			if(isAPP) {
				var preUrl = plus.webview.currentWebview().opener();
				preUrl.evalJS("refresh()");
			}
			com_back();
		}
		//下拉刷新
		function refresh () {
			app.init();
		}
		var app = null;
		function fun1 () {
			down_load(); //下拉刷新开启
			var print_index = getItem("print_index")?getItem("print_index"):0;
			app = new Vue({
				el:"#app",
				data:{
					b_lg: global_lange, //语言包
					print_list:[],//打印机列表
//					checked_print_list:[],//已选择的打印机id
					
					is_checked:print_index//选择哪个打印机
				},
				created: function () {
					common_ajax(1, {}, "get_print_list", function(res) {
						$("header .header_title").text(app.b_lg['1472']);
						if (res.status == 1) {
							app.print_list = res.result.list;
						}else {
							mui.toast(res.msg);
						}
					})
				},
				methods:{
					init: function () {
						
					},
					gotoart: function (e) {
						clicked(e)
					},
					toQueue: function (n) {
						clicked('queue_takeNumber.html');
						if(isAPP) {
							var ws = plus.webview.currentWebview();
							plus.webview.close(ws,false)
						}
						setItem("pageflag",n);
					},
					choose: function (id,v) {
//						var index = app.checked_print_list.indexOf(id);
//						if (index == -1) {
//							app.checked_print_list.push(id);
//						}else {
//							app.checked_print_list.splice(index,1);
//						}
						if (v.checked == 1) {
							v.checked = 0;
						}else {
							v.checked = 1;
						}
						console.log(v)
						console.log(app.print_list)
					},
					printSet: function () {
						var checked_print_list_str="";
						$.each(app.print_list, function(index,item) {
							if (item.checked == 1) {
								checked_print_list_str += item.id + ","
							}
						});
						checked_print_list_str = checked_print_list_str.substring(0,checked_print_list_str.length-1)
						if (checked_print_list_str == "") {
							var btnArray = [ app.b_lg['1190']];
//							app.b_lg['1508']
							mui.confirm(app.b_lg['1508'], app.b_lg['1320'], btnArray, function(e) {
								
							}, "div")
						}else {
							common_ajax(1, {"print":checked_print_list_str}, "queue_print_set", function(res) {
								if (res.status == 1) {
									mui.toast(app.b_lg['1489'])
								}else {
									mui.toast(res.msg);
								}
							})
						}
						
					}
				}
			})
		}
	</script>
</html>
